package com.emapp.lccode.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.chad.library.adapter.base.BaseQuickAdapter
import com.emapp.lccode.R
import com.emapp.lccode.databinding.GvFilterImageBinding
import com.luck.picture.lib.entity.LocalMedia

class OrderImageKtAdapter :BaseQuickAdapter<LocalMedia, OrderImageKtAdapter.VH>() {

    class VH(
        parent: ViewGroup,
        val binding: GvFilterImageBinding = GvFilterImageBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        return VH(parent)
    }

    override fun onBindViewHolder(holder: VH, position: Int, item: LocalMedia?) {

        Glide.with(context)
            .load(item?.path)
            .centerCrop()
            .placeholder(R.color.app_color_f6)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(holder.binding.fiv)
    }


}